 <!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<title></title>
		<link rel="stylesheet" type="text/css" href="../css/index.css" />
		<link rel="stylesheet" href="../css/yangshi.css" />
		<script src="../js/vue.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/vant.min.js" type="text/javascript" charset="utf-8"></script>
		<!-- 引入组件 -->
		<script src="html5plus://ready"></script>
		<script src="../js/ajax.js"></script>
		<script type="text/javascript">
			document.addEventListener('plusready', function() {
				//console.log("所有plus api都应该在此事件发生后调用，否则会出现plus is undefined。"

			});
		</script>
	</head>

	<body>
		<div id="app">
			<header>
				<img src="../img/timg.jpg" style="width: 180px;height: 120px;margin-top: 50px;margin-left: 100px;" />
			</header>
			<section>

				<div style="margin-left: 15px;margin-top: 19px;">
					<van-icon name="phone"></van-icon>手机号码
				</div>
				<div style="margin-left: 15px;margin-top: 13px;"><input type="text" id="account" class="haomayangshi" placeholder="请输入书记号码" /></div>
				<div style="margin-left: 15px;margin-top: 19px;">
					<van-icon name="wap-home"></van-icon>登录密码
				</div>
				<div style="margin-left: 15px;margin-top: 13px;"><input type="password" id="password" class="haomayangshi" placeholder="请输入密码" /></div>
				<div style="margin-left: 280px;margin-top: 23px;" onclick="password()">忘记密码？</div>
				<div style="text-align: center;margin-top: 20px;"> 
					<van-button @click="dl" type="danger" style="width: 350px;">立即登录</van-button>
				</div>
				<div style="margin-top: 15px;text-align:center" onclick="zezh()">还没有注册，立即注册</div>
			</section>
		</div>
		<script>
			var vm = new Vue({
				el: "#app",
				data: {

				},
				created() {
					localStorage.clear();
				},
				methods:{
					dl:function(){
						var account=document.getElementById("account").value;
						var password=document.getElementById("password").value;
						ajax({
							url: "http://dsapi.ysd3g.com/api/login",
							dataType: "jsonp",
							data: {account: account,password:password},
							success: function(res) {
								console.log(res);
								if(res.Error==true){
									vm.$toast("登录失败");
								}								
								else{
									vm.$toast("登录成功");
									console.log(res.Key);
									localStorage.setItem("keys",res.Key);
// 									var user=plus.webview.getWebviewById("user");
// 									user.reload(true);
									localStorage.setItem("userData",res.UserData);
									localStorage.setItem("name",res.UserData.NickName);	
									localStorage.setItem("phone",res.UserData.Phone);									
									plus.webview.open("personalCenter.html");
								}
								
							}
						})
					}
				}
			})
		</script>
		<script type="text/javascript">
			function zezh(){				
				plus.webview.open("register.html")
			}
			function password(){
				plus.webview.open("wjma.html")
			}	
			
		</script>
	</body>

</html>
